# -*- coding: utf-8 -*-

import threading, urllib.request
from time import ctime, sleep

def music(func):
    for i in range(2):
        print("i was listening to %s. %s" %(func, ctime()))
        sleep(4)

def movie(func, name):

    for i in range(2):
        print(name)
        print("i was at the %s. %s" %(func, ctime()))
        sleep(5)

def download():
    url = "http://commissionadmin.ymatou.cn/file/RateStrategyTemplate.xlsx"
    downPath = "D:\\在测项目\\" + "RateStrategyTemplate.xlsx"

    urllib.request.urlretrieve(url, downPath)

threads = []
t1 = threading.Thread(target = music, args = (u'爱情买卖',))
threads.append(t1)

t2 = threading.Thread(target = movie, args = (u'阿凡达', 'lalala'))
threads.append(t2)

if __name__ == '__main__':
    for t in threads:
        t.setDaemon(True)
        t.start()

    t.join()

    print("all over %s" %ctime())

    #download()